<template>
    <el-dialog
        title="入口权限"
        center
        :visible.sync="visible"
        width="1100px"
        :before-close="handleCancel"
    >
    <div class="commissionsDialog">
        <AddOpenProxyAudit ref="AddOpenProxyAudit" :outlineInfo="outlineInfo"/>
    </div>
    <div slot="footer" class="dialog-footer">
        <template>
            <el-button @click="handleCancel">
                {{ $t('agent.cancel') }}
            </el-button>
            <el-button type="primary" @click="handleOK" :loading="loading">
                {{ $t('agent.submit') }}
            </el-button>
        </template>
    </div>
    </el-dialog>
</template>
<script>
import AddOpenProxyAudit from './AddOpenProxyAudit'

export default {
    name: 'CommissionsDialog',
    components: {
        AddOpenProxyAudit
    },
    props: {
        visible: {
            type: Boolean,
            default: false
        },
        outlineInfo: {
            type: Object,
            default: () => ({})
        }
    },
    data () {
        return {
            loading: false
        }
    },
    watch: {
        visible(newVal) {
        }
    },
    methods: {
        handleCancel() {
            this.$emit('update:visible', false)
            this.$emit('refresh')
        },
        async handleOK() {
            try {
                this.loading = true
               const eventId = await this.$refs['AddOpenProxyAudit'].submitForm()
               this.$emit('update:visible', false)
               this.$emit('success', eventId)
            } catch (err) {
                console.error(err)
                throw err
            } finally {
                this.loading = false
            }
        }
    }
}
</script>

